home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-04-16 | 2.4 KB | 92 lines | [TEXT/CWIE] |
- // VectorIndex.h
- // Copyright: © 1994 - 1998 by Apple Computer, Inc., all rights reserved.
-
- //// IAIndex that stores vectors.
-
- #pragma once
- #ifndef VectorIndex_h
- #define VectorIndex_h
-
- #pragma import on
-
- #if PRAGMA_STRUCT_ALIGN
- #pragma options align=power
- #endif
-
- #include "TermIndex.h"
- #include "TFVector.h"
-
- #pragma IA_BEGIN_EXPORTS
-
- const uint32 VectorIndexType = 'Vec4';
-
- class VectorDocInfo : public DocInfo {
- public:
- VectorDocInfo() : vectorBlock(0), DocInfo() {}
- VectorDocInfo(IADoc* d, DocID i) : DocInfo(d,i), vectorBlock(0) {}
- // IAOrderedStorable methods
- IAStorable* DeepCopy() const;
- IABlockSize StoreSize() const;
- void Store(IAOutputBlock* output) const;
- IAStorable* Restore(IAInputBlock* input) const;
- IABlockID GetVectorBlockID() const {return vectorBlock;}
- void SetVectorBlockID(IABlockID blockID){vectorBlock = blockID;}
- protected:
- void DeepCopying(const IAStorable* source);
- void Restoring(IAInputBlock* input, const IAStorable* proto);
- private:
- VectorDocInfo(VectorDocInfo&);
- IABlockID vectorBlock;
-
- };
-
- // needed for private member declaration
- class TermIdUpdateSet;
-
- class VectorIndex : public virtual TermIndex {
- public:
- VectorIndex(IAStorage* s, IACorpus* c, IAAnalysis* a,
- uint32 t = VectorIndexType, IABlockID r = NULL);
- ~VectorIndex();
-
- // VectorIndex-specific method:
- virtual TFVector* GetTFVector(IADoc* doc);
-
- IADefineNarrowMethods(VectorIndex, IAIndex); // support for IANarrow
-
- virtual bool ValidateDocInfos(bool verbose);
-
- protected:
- // TermIndex methods we augment to store vectors:
- DocInfo* MakeDocInfo(IADoc* doc, DocID docID);
- void UpdateDocInfo(DocInfo* i, TFVector* vector);
- void MergeDocInfo(DocInfo* i, DocInfo* addDi, TermIndex* addIndex, TermID* reMap);
- uint32 MergeDocCost();
-
- void FlushUpdates();
- void DeletingDoc(DocInfo* i);
- // Optimized version of GetTFMaps.
- bool GetTFMaps(IADoc** docs, uint32 nDocs, TFMap** tfMaps, Progress* p);
- // delete doc clean up
- void ExpungeTermPostings();
- private:
- void WriteTFVector(TFVector* vector, IABlockID block);
-
- TFVector* ReadTFVector(IABlockID block);
- TFVector* ReadTFVector(IAStorage* storage, IABlockID block);
-
- TermIdUpdateSet* termIdUpdateSet;
- void FlushTermIdUpdates();
-
- VectorIndex(VectorIndex&);
- };
-
- #pragma IA_END_EXPORTS
-
- #if PRAGMA_STRUCT_ALIGN
- #pragma options align=reset
- #endif
-
- #pragma import reset
- #endif
-